﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

using XianShang.Common;
using XianShang.Entity;

namespace XianShang.Data.DataProvider
{
   public class Message
    {

        /// <summary>
        /// 獲取信息顯示留言信息列表
        /// </summary>
        /// <param name="pageIndex">當前索引頁</param>
        /// <param name="pageSize">分頁大小</param>
        /// <returns></returns>
       public static DataTable GetMsgInfo(int pageSize, int pageIndex)
       {
           return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetMsgInfo(), pageSize, pageIndex);
       }
       /// <summary>
       /// 獲取信息顯示留言信息列表 條件 SHOW=TRUE
       /// </summary>
       /// <returns></returns>
       public static DataTable GetMsgInfo()
       {
           return Utils.DrToDt(DatabaseProvider.GetInstance().GetMsgInfo());
       }

        /// <summary>
        /// 獲取留言信息的總數條件 SHOW=TRUE
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
       public static int GetMsgNum()
       {
           return DatabaseProvider.GetInstance().GetMsgNum();
       }
       /// <summary>
        /// 獲取信息顯示留言信息列表
        /// </summary>
        /// <returns></returns>
       public static DataTable GetAllMsgInfo()
       {
           return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllMsgInfo());
       }
       /// <summary>
       /// 獲取信息顯示留言信息列表
       /// </summary>
       /// <param name="pageIndex">當前索引頁</param>
       /// <param name="pageSize">分頁大小</param>
       /// <returns></returns>
       public static DataTable GetAllMsgInfo(int pageSize, int pageIndex)
       {
           return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllMsgInfo(),pageSize,pageIndex);
       }
         /// <summary>
        /// 根據更新一條留言信息
        /// </summary>
        /// <returns></returns>
       public static int UpMsgInfoById(LeaveMsgInfo msg)
       {
           return DatabaseProvider.GetInstance().UpMsgInfoById(msg);
       }


        /// <summary>
        /// 根據留言ID刪除留言信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
       public static int DelMsgInfo(string Id)
       {
           return DatabaseProvider.GetInstance().DelMsgInfo(Id);
       }
        /// <summary>
        /// 插入一條新紀錄
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
       public static int AddMsgInfo(LeaveMsgInfo msg)
       {
           return DatabaseProvider.GetInstance().AddMsgInfo(msg);
       }
       /// <summary>
        /// 根據ID取得留言信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
       public static DataTable GetMsgInfoById(string id)
       {
           return DatabaseProvider.GetInstance().GetMsgInfoById(id);
       }
       /// <summary>
        /// 根據ID修改 recontent retime show 
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static int UpDateReContentAndReTimeAndShowById(LeaveMsgInfo msg)
        {
           return DatabaseProvider.GetInstance().UpDateReContentAndReTimeAndShowById(msg);
        }
        /// <summary>
        /// 根據id修改Show
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static int UpDateShowById(LeaveMsgInfo msg)
        {
            return DatabaseProvider.GetInstance().UpDateShowById(msg);
        }
    }
}
